using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace CMSApplication.Models.Mapping
{
    public class VersionMap : EntityTypeConfiguration<Version>
    {
        public VersionMap()
        {
            // Primary Key
            this.HasKey(t => t.version_id);

            // Properties
            // Table & Column Mappings
            this.ToTable("Versions");
            this.Property(t => t.version_id).HasColumnName("version_id");
            this.Property(t => t.version_num).HasColumnName("version_num");
            this.Property(t => t.content_id).HasColumnName("content_id");

            // Relationships
            this.HasRequired(t => t.Content)
                .WithMany(t => t.Versions)
                .HasForeignKey(d => d.content_id);

        }
    }
}
